package com.fuxue.mapper;

import com.fuxue.dto.CommitDTO;
import com.fuxue.dto.GetCommitDTO;
import com.fuxue.entity.Commit;
import com.fuxue.vo.ForumVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CommitMapper {
    @Insert("insert into commit (answer_id, user_id, context,type, creat_time,user_name,avatar)"+"values"+
            "(#{answerId},#{userId},#{context},#{type},#{creatTime},#{userName},#{avatar})")
    void InsertCommit(CommitDTO commitDTO);

    @Update("update answer set commit_count = commit_count + 1 where answer_id = #{id}")
    void updateAnswerCount(Integer id);
@Select("select * from commit where answer_id = #{answerId}")
    Page<Commit> getAllCommit(GetCommitDTO getCommitDTO);
}
